/*
 * DialogDelegate.h  0.4.0 / Dec 04, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef DIALOGDELEGATE_H
#define DIALOGDELEGATE_H

#include "Cute4jSwing.h"

#include "WindowDelegate.h"

// DialogDelegate Class. -------------------------------------------------------

/*!
 * \brief Dialog Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT DialogDelegate : public WindowDelegate
{
  Q_OBJECT
protected:
  DialogDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  jint exec(JNIEnv *env);
  void done(JNIEnv *env, jint result);
public: // native calls
  static jlong newInstance(JNIEnv *env, jobject obj);
public:
  inline QDialog *qDialog() const;
};

// DialogDelegate :: Public Inline Member Function. ----------------------------

/*!
 * \brief Returns QDialog adaptee.
 *
 * \return QDialog adaptee
 */
inline QDialog *DialogDelegate::qDialog() const
{
  return static_cast<QDialog *>(qObject());
}

// Macro Definition. -----------------------------------------------------------

#define DIALOG_DELEGATE (reinterpret_cast<DialogDelegate *>(delegate))

#endif // DIALOGDELEGATE_H
